package com.nile;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channel;
import java.nio.channels.FileChannel;
import java.sql.Time;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author: zhang kai
 * @Date: 2022/06/16
 * @Description:
 */
public class BufferDemo {
    public static void main(String[] args) throws IOException {
//        FileChannel channel = null;
//        ByteBuffer b1 = ByteBuffer.allocate(1024);
//        ByteBuffer b2 = ByteBuffer.allocate(48);
//        ByteBuffer[] array = {b1,b2};
//        channel.read(array);

        LocalTime l1 = LocalTime.parse("01:30");


        LocalTime lt = LocalTime.parse("02:30");
        Duration duration = Duration.between(l1, lt);
       System.out.println(lt.toString());
       System.out.println(duration.toMinutes());
       System.out.println(Time.valueOf(l1));

       // 1-1.30
        LocalTime l3 = LocalTime.parse("03:30");


        LocalTime l4 = LocalTime.parse("04:00");
        LocalTime l5 = LocalTime.parse("14:00");
        System.out.println(l3.isAfter(l4));
        System.out.println(l4.getMinute());
        if (l4.getMinute() != 0 && l4.getMinute() != 30) {
          System.err.println(1);
        }
        List<LocalTime> list = new ArrayList<>();
        list.add(l5);
        list.add(l1);
        list.add(lt);
        list.add(l4);
        list.add(l3);

        Collections.sort(list, (c1, c2) -> {
            if(c1.isBefore(c2)) {
                return -1;
            }
            return 1;
        });
        System.out.println(list);
        System.out.println(MessageFormat.format("医院:{0},核酸自助下单存在多条配置项！", 12345+""));
    }
}
